Skip to content

Feat: video download stats#7437

Open
pipoprods wants to merge 16 commits intoChocobozzz:developfrom
Worteks:feat/video-download-stats
Open

Feat: video download stats#7437
pipoprods wants to merge 16 commits intoChocobozzz:developfrom
Worteks:feat/video-download-stats

Conversation

@pipoprods
Copy link
Contributor

Description

The video views are tracked but downloads are not. This behavior makes the identification of useless videos (the ones that are no longer viewed/downloaded by users) difficult.

This PR introduces video download stats (overall counter and timeseries).

I've made the download stats the more generic I could so it opens a door to refactoring views stats or adding new kinds of stats.

Related issues

Has this been tested?

  • 👍 yes, I added tests to the test suite
  • 💭 no, because this PR is a draft and still needs work
  • 🙅 no, because this PR does not update server code
  • 🙋 no, because I need help

Screenshots

Screenshot 2026-02-10 at 14-42-39 Manage your video - PeerTube

Copy link
Owner

@Chocobozzz Chocobozzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi and thank you for the PR.

Can we refactor it to track downloads in videoView table (that would be renamed to videoStats or something like that)? You would add a downloads column, and merge your save logic in video-views-stats.ts

We also have to track downloads from federated instances. You can introduce a new Download type and use the same logic as send-view.ts file (you only need to send the Download activity to the origin server, the origin server won't forward it).

@pipoprods
Copy link
Contributor Author

pipoprods commented Mar 5, 2026

Hi @Chocobozzz

I've addressed the first part:

Can we refactor it to track downloads in videoView table (that would be renamed to videoStats or something like that)? You would add a downloads column, and merge your save logic in video-views-stats.ts

Could you please have a look at it and send me a feedback?

I'll try and address the question of remote instances shortly.

@pipoprods
Copy link
Contributor Author

Hi @Chocobozzz

I've addressed the federation part by duplicating the view part without being able to test anything. I need your help on the following points:

  • How can I test that download counters are correctly propagated between instances?
  • Is there anything I should do with this code so we don't get into an infinite loop?

@pipoprods pipoprods requested a review from Chocobozzz March 12, 2026 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants